<?php

class Index extends MY_Controller
{
    public function __construct()
    {
        parent::__construct();
        $this->load->service('Service_urls');
        $this->load->driver('cache');
    }

    public function index()
    {
        $params = $this->getParams();
        $page = !empty($params['page']) ? ((int)$params['page'] > 0 ? (int)$params['page'] : 1) : 1;

        $cond = ['status' => 0, 'show' => 1, 'title !=' => ''];

        $list = $this->Service_urls->getList($page, $cond, 24, ['id', 'DESC']);
        $pagination = $this->Service_urls->getPagination($page, $cond, 24);
        $pagination['url'] = '/index/index';
        $this->assign('tag', '最新');
        $this->assign('title', '最新');
        $this->assign('keywords', $this->site['keywords']);
        $this->assign('key', '');
        $this->assign('urls', $list);
        $this->assign('pagination', $pagination);
        $this->display("index.tpl");
    }
}